<?php

namespace App\Http\Controllers\v1\designPattern\structural;

use App\Http\Controllers\Controller;

/**
 * 结构模式之适配器模式
 * 包装适配器原始类，十七兼容客户端接口(方法)，
 * 这里是包装request方法，兼容specificRequest方法
 */
class Adapter extends Controller implements Target
{
    private $adapter;

    public function __construct(Adaptee $adapted)
    {
        parent::__construct();
        $this->adapter = $adapted;
    }

    public function request(): string
    {
        return $this->adapter->specificRequest();
    }
}